# Contributor: John Regan <john@jrjrtech.com>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=s6-networking
pkgver=2.7.0.4
pkgrel=0
pkgdesc="skarnet.org's UCSPI TCP and TLS tools, access control tools, and network time management utilities."
url=https://skarnet.org/software/s6-networking/
arch="all"
license="ISC"
options="!check"
_skalibs_version=2.14.3
_execline_version=2.9.6
_s6_version=2.13.1
_s6dns_version=2.4.0
_bearssl_version=0.6
makedepends="
	skalibs-dev>=$_skalibs_version
	execline-dev>=$_execline_version
	s6-dev>=$_s6_version
	s6-dns-dev>=$_s6dns_version
	bearssl
	bearssl-dev>=$_bearssl_version"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev $pkgname-doc"
source="https://skarnet.org/software/s6-networking/s6-networking-$pkgver.tar.gz s6-networking.pc.in"

build() {
	./configure \
		--enable-shared \
		--disable-allstatic \
		--prefix=/usr \
		--libexecdir="/usr/lib/$pkgname" \
		--enable-ssl=bearssl
	make
}

package() {
	make DESTDIR="$pkgdir" install
	sed -e "s/@@VERSION@@/$pkgver/g; s/@@SKALIBS_VERSION@@/${_skalibs_version}/g;" "$srcdir/$pkgname.pc.in" > "$srcdir/$pkgname.pc"
	install -D -m 0644 "$srcdir/$pkgname.pc" "$pkgdir/usr/lib/pkgconfig/$pkgname.pc"
	mkdir -p "$pkgdir/usr/share/doc"
	cp -a "$builddir/doc" "$pkgdir/usr/share/doc/$pkgname"
}

sha512sums="
2a789cbc2f901e78fffb959fcbddf89c71de75c0d57d3fb1a927418fa8a43f71057c2b50b03e15aa45d5d7ee6521e76b697ae57eef2b7eea760ef9295314dc9b  s6-networking-2.7.0.4.tar.gz
d6a17ebe194c4ffb1c402fec7589e34961b2b73cd4b380c2ffe9e7d74667d150f4c200cfc6f2e07e44eb14fbb8c51d0e1d2f39c284553472c5b4ae1137381d9f  s6-networking.pc.in
"
